package com.xingzhe.pengji.security.controller.ajax;

import org.directwebremoting.annotations.Param;
import org.directwebremoting.annotations.RemoteMethod;
import org.directwebremoting.annotations.RemoteProxy;
import org.directwebremoting.spring.SpringCreator;
import org.springframework.beans.factory.annotation.Autowired;

import com.xingzhe.pengji.security.domain.Resource;
import com.xingzhe.pengji.security.services.ResourceService;

/**
 * @Title ： 三江学院 毕业设计
 * @Description ：ResourceControlAjax 异步加载
 * @author ：LuFengLiang
 * @Company: IT行者工作室
 * @Copyright: Copyright (c) 2012-3-3
 * @version ： 1.0
 */
@RemoteProxy(creator=SpringCreator.class,creatorParams = @Param(name = "beanName", value = "resourceConAjax"))
public class ResourceControllerAjax<T extends Resource> {
	@Autowired
	private ResourceService<T> resourceService;
	
	@RemoteMethod
    public String judjeResourceNameExit(String resourceName)
	{
		@SuppressWarnings("unchecked")
		T entity=(T) new Resource();
		entity.setName(resourceName);
		if(null==resourceService.getResourceByName(entity))
			return "true";
		return "false";
	}

}

